package com.wang.vedio.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.wang.vedio.player.PasswordActivity;

public class ScreenStatusReceiver extends BroadcastReceiver {
    String SCREEN_ON = "android.intent.action.SCREEN_ON";
    String SCREEN_OFF = "android.intent.action.SCREEN_OFF";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (SCREEN_ON.equals(intent.getAction())) {
            Log.i("系统请求：","开");
            Intent intentNew=new Intent(context, PasswordActivity.class);
            intentNew.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            Bundle bundle = new Bundle();
            bundle.putInt("type",2);
            intentNew.putExtras(bundle);
            context.startActivity(intentNew);

        } else if (SCREEN_OFF.equals(intent.getAction())) {
            Log.i("系统请求：","关");
        }
    }
}
